package com.yelink.metrics.config;

import cn.hutool.extra.spring.SpringUtil;
import com.yelink.metrics.config.MetricsParam;
import com.yelink.metrics.core.constant.Constant;
import lombok.Data;
import org.springframework.stereotype.Component;

/**
 * @author idea
 * 作为一个容器的bean， 使用spel可作用于@KafkaListener注解的字段上
 */
@Data
@Component("metricsTopic")
public class MetricsTopic {
    private static final String SUFFIX;
    static {
        MetricsParam metricsParam = SpringUtil.getBean(MetricsParam.class);
        SUFFIX = metricsParam.getModule();
    }

    /**
     * 触发器消息主体：每个module独有
     */
    private String triggerTopic = Constant.KAFKA_TOPIC_PREFIX + SUFFIX;

}
